package com.example.wangyeming.getuidemo.utils;

import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

/**
 * Created by wangyeming on 15-6-12.
 */
public class NotificationNumberUtil {
    
    /**
     * 获取指定notificationId的
     * @param context
     * @param notificationId
     * @return
     */
    public static int getNotificationNumber(Context context, int notificationId) {
        SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(context);
        int notificationNumber = sharedPref.getInt(String.valueOf(notificationId), 0);
        SharedPreferences.Editor editor = sharedPref.edit();
        editor.putInt(String.valueOf(notificationId), ++notificationNumber);
        editor.commit();
        return notificationNumber;
    }
}
